﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FUI;
using System.IO;
using System.Reflection;

namespace TransformationTest
{
    public partial class Form1 : Form
    {
        FUIManager m_FUIManager;
        public Form1()
        {
            m_FUIManager = new FUIManager();
            if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0)
                foreach (string Filename in Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll"))
                {
                    Assembly Asm = Assembly.LoadFile(Filename);
                    foreach (Type AsmType in Asm.GetTypes())
                    {
                        if (AsmType.GetInterface("IFUI") != null && AsmType.Name != "FUIBase")
                        {
                            IFUI Plugin = (IFUI)Activator.CreateInstance(AsmType);
                            m_FUIManager.LstFUI.Add(Plugin);
                        }
                    }
                }
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(m_FUIManager.LstFUI[6].generateInitialization());
        }
    }
}
